#ifndef _3761_AFN_0D_F1_H_
#define _3761_AFN_0D_F1_H_
#include <map>
#include <string>
#include <sstream>
#include "../../calendar.h"
#include "../../controller.h"
using namespace std;

class Afn0df1
{
public:
	map<uint16_t,list<sMtAfn0dF1> > mpn;
public:
	string getPnString(uMtApp& app)
	{
		stringstream s;
		sMtYYMMDD &d = app.sTd_d.sT;

		s << "20" << (int)(d.ucYY) << "-" << (int)(d.ucMM) << "-" << (int)(d.ucDD);

		return s.str();
	}
	bool handle(Controller& controller, int index)
	{
		Calendar now;

		UserBuffer& rb = controller.recvbuf;
		UserBuffer& sb = controller.sendbuf;
		uMtApp& ra = rb.getApp(index);
		uMtApp& sa = sb.getApp(index);
		sMtAfn0dF1& f1 = sa.afn0df1;

		/*
		sb.setCmd((eMtCmd)rb.getCmd(index), index);
		sb.setPn(rb.getPn(index), index);
		sb.setApp(true, index);
		*/
		sa = ra;
		printf("sb.getCmd(%04X)\n", sb.getCmd(index));
		printf("sb.getFn(%d)\n", sb.getFn(index));
		printf("sb.getPn(%d)\n", sb.getPn(index));


		f1.sTd_d = ra.sTd_d;

		f1.sTime.ucYY = now.year() - 2000;
		f1.sTime.ucMM = now.month();
		f1.sTime.ucDD = now.day();
		f1.sTime.ucHH = now.hour();
		f1.sTime.ucmm = now.minute();

		f1.ucM = 2;
		f1.dFrthHavePowerT	 = 1111.2222;
		f1.dFrthHavePower[0] = 1111.2222;
		f1.dFrthHavePower[1] = 1111.2222;

		f1.dFrthNonePowerT	 = 2222.33;
		f1.dFrthNonePower[0] = 2222.33;
		f1.dFrthNonePower[1] = 2222.33;

		f1.dNonePowerP1T	= 3333.44;
		f1.dNonePowerP1[0]	= 3333.44;
		f1.dNonePowerP1[1]	= 3333.44;

		f1.dNonePowerP4T	= 4444.55;
		f1.dNonePowerP4[0]	= 4444.55;
		f1.dNonePowerP4[1]	= 4444.55;

	}
};

#endif//_3761_AFN_0D_F1_H_
